/*
 * Modbus mutex for RTU.
 * Copyright (c) 2012  apleilx
 * All rights reserved.
 * no limite
 */

/* ----------------------- Platform includes --------------------------------*/

#include "os_obj.h"
#include "mbdef.h"
#include "sys_task.h"

//static osMutexId     MutexObjmbCmd;
//static uint8_t       mbMutexCreated = 0;

/*******************************************************************************
* @brief  mbOsSyncMutexCreat
* \param[in] none
* \retval: none
*******************************************************************************/
void mbOsSyncMutexCreat(void)
{

}

/*******************************************************************************
* @brief  mbOsSyncMutexPend
* \param[in] none
* \retval: none
*******************************************************************************/
void mbOsSyncMutexPend(void)
{
    //OSMutexPend (&MutexObjmbCmd, 0,  OS_OPT_PEND_BLOCKING, &cpu_ts, &os_err);
    //    osMutexWait(MutexObjmbCmd,1000);
}

/*******************************************************************************
* @brief  mbOsSyncMutexPost
* \param[in] none
* \retval: none
*******************************************************************************/
void mbOsSyncMutexPost(void)
{
    //OSMutexPost (&MutexObjmbCmd,  OS_OPT_POST_NO_SCHED, &os_err);
    //    osMutexRelease(MutexObjmbCmd);
}

/*******************************************************************************
* @brief  mb_os_delay
* \param[in] ms : milisecond
* \retval: none
*******************************************************************************/
void mb_os_delay(uint32_t ms)
{
    osDelay(ms_ticks(ms));
}

/*******************************************************************************
* @brief  mb_os_send
* \param[in] event : event to send
* \retval: none
*******************************************************************************/
void mb_os_send(uint16_t event)
{
    tx_event_flags_set(os_obj.eid_mb,
				event,
				TX_OR);
}

